<foreach name="cartList" item="v"  key="k">
  <if condition="$v[selected] eq '1' or in_array($v[id], I('show_goods_ids'))">
    <div class="cpk">
      <div class="checkk <if condition="$v[selected] eq 1" >gou1</if>">
        <input type="hidden" name="cart_select[{$v.id}]" <if condition="$v[selected] eq 1" >value="1"</if>>
      </div>
      <img class="spimg" src="{$v.goods_id|goods_thum_images=83,83}" alt="" />
      <p class="sptitle">{$v.goods_name}</p>
      <span class="spzs">{$v.goods_remark|getSubstr=0,100}</span>
      <h3 class="spprice">￥{$v.member_goods_price}</h3>
      <p class="spprice1">￥{$v.goods_price}</p>
      <h3 class="number">{$v.goods_num}</h3>
      <h3 class="allprice">￥{$v.goods_fee}</h3>
      <input type="hidden" name="goods_num[{$v.id}]" value="{$v.goods_num}">
      <input type="hidden" name="show_goods_ids[]" value="{$v.id}">
    </div>
  </if>
</foreach>

<script type="text/javascript">
  // 选择按钮
  $(".checkk").click(function(){
    if($(this).hasClass("gou1")){
      $(this).removeClass("gou1");
      $(".qx").removeClass("gou2");
      $(this).children('input').val(0);
    }else{
      $(this).addClass("gou1");
      $(this).children('input').val(1);
    }
    ajax_cart_list();
  });
</script>